<?php

// $Id$


require_once($WSC->get_site_inc_dir().'modules/tangra_cms/_sys/tcms_admin_page_w_fctrl_ua.class.php');
require_once($WSC->get_site_inc_dir().'modules/tangra_cms/forms/_ci/ci_type/ci_type_form_ctrl.class.php');


class CI_Type_Edit_WP extends TCMS_Admin_Page_W_FCtrl_UA {
	public function create_view($name = 'default') {
		$ret = new TCMS_Admin_Page_View($this, $name, 'modules/tangra_cms/pages/_ci/');

		return $ret;
	}


	protected function create_form_ctrl() {
		$dbc = $this->get_dbc();
		$tvm = $this->get_tvm();

		$config = $this->get__config();
		$ret = new CI_Type_Form_Ctrl('ci_type', $tvm, $dbc, 'obj_id', $config->get_document_root_dir(), $config->get_hidden_dir().'inc/');

		return $ret;
	}


	protected function on_add_new() {
		$this->form_ctrl->set_permanent_external_param('add_new', 1);
		$this->export('add_new', 1);
	}


	protected function on_received_id($object_id) {
		$object = $this->form_ctrl->get_object();
		$this->export('ci_type_id', $object_id);
	}


	protected function create_default_redir_view() {
		$object = $this->form_ctrl->get_object();
		$redir_view = $this->create_redirect_view($this->get_redir_on_success(), array('manage' => $object->get_id()));

		return $redir_view;
	}
}